// @Description：预定义任务的集合，都在这里定义
package taskset

import (
    "time"
    "cloud_worm/util/uweb/ucron"
    "cloud_worm/wormweb/controllers/ctrsecurity/crontask"
    _ "cloud_worm/wormweb/controllers/ctrsecurity/crontask/taskset/agent"
    _ "cloud_worm/wormweb/controllers/ctrsecurity/crontask/taskset/report"
)

// @Description：一个任务的实现。这里是test的任务
type TestJob struct {
    Name            string
}

func (t TestJob) Run()  {
    recordID, err := crontask.CronJobBegin(t)
    if err == nil {
        defer crontask.CronJobEnd(recordID, t, "")
    }

    time.Sleep(5 * time.Second)
    return
}

// @Description: 任务注册
func init()  {
    ucron.RegisterCronJob(&TestJob{Name: "test_task"})
}
